package com.flnet.spsys.controller;

import com.flnet.spsys.service.OssService;
import com.flnet.spsys.utils.ResultJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(description="阿里云文件管理")
@CrossOrigin //跨域
@RestController
@RequestMapping("/eduoss/fileoss")
public class OssController {
    @Autowired
    private OssService ossService;
    @ApiOperation(value = "文件上传")
    @PostMapping("upload")
    public ResultJson upload(
            @ApiParam(name = "file",value = "文件",required = true)
            @RequestParam("file") MultipartFile file){
        String uploadUrl = ossService.upload(file);
        //返回url对象
        return ResultJson.success(null);// .ok().message("文件上传成功").data("url",uploadUrl);

    }

}
